﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    新闻
</asp:Content>



<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <article id="newcontainer">
        <div class="newsbox">
            <div>当前位置：Home/News</div>
            <div style="border-bottom: 1px solid; border-bottom-color: #FFFFFF;"></div>
            <br />
            <div class="container">
                <div class="newsbox_left">
                    <% hotel.BLL.tb_news_type newtype = new hotel.BLL.tb_news_type();
                       hotel.BLL.tb_news newbll = new hotel.BLL.tb_news();
                       List<hotel.Model.tb_news_type> listt =  newtype.GetModelList("");
                       foreach(hotel.Model.tb_news_type modt in listt)
                       {
                    %>
                    <div class="menuTitle">
                        <%=modt.title  %>
                    </div>
                    <div class="menuContent">
                        <ul>
                            <%  List<hotel.Model.tb_news> news = newbll.GetModelList("type =" + modt.ID.ToString());
                                foreach(hotel.Model.tb_news modn in  news)
                                {  %>
                            <li><a  onclick="getnew(<%=modn.ID %>)"><%=modn.title%></a></li>
                            <%} %>
                        </ul>
                    </div>
                    <%} %>
                </div>
                <div class="newsbox_right">
                    <div class="news_title">
                        <span id="new_title"></span>
                    </div>
                    <div class ="news_time" id="new_time">
                    </div>
                    <div class="news_article" id="zoom">
                    </div>
                </div>
            </div>
        </div>
    </article>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="scriptHolder" runat="server">
    <script src="../../Scripts/js/json2.min.js"></script>
    <style type="text/css">
        .news_title {
            width: 640px;
            float: right;
            padding: 5px 0px;
            font-size: 12px;
            line-height: 25px;
            color: #666;
            text-align: center;
        }
        .news_title span {
            width: 640px;
            height: 40px;
            float: left;
            color: #000;
            line-height: 40px;
            text-align: center;
            font-size: 22px;
            font-family: "微软雅黑", "黑体";
            font-weight: normal;
            display: inline;
            padding-top: 10px;
        }
        .news_time {
            width: 640px;
            float: left;
            padding: 0px 0px 5px 0px;
            font-size: 12px;
            line-height: 25px;
            color: #999;
            text-align: center;
            position: relative;
            border-bottom: 1px dotted #dbdbdb;
        }

        .news_article {
            float: left;
            padding: 15px 0px 10px 0px;
            line-height: 25px;
            font-size: 14px;
        }


        .container {
            width: 100%;
            text-align: center;
        }

        .menuTitle {
            width: 148px;
            height: 25px;
            background-image: url(../../Images/expand.gif);
            margin: 0 auto;
            line-height: 25px;
            font-size: 12.7px;
            font-weight: bold;
            color: #43860c;
            cursor: pointer;
            margin-top: 6px;
        }

        .activeTitle {
            width: 148px;
            height: 25px;
            background-image: url(../../Images/fold.gif);
            margin: 0 auto;
            line-height: 25px;
            font-size: 12.7px;
            font-weight: bold;
            color: #43860c;
            cursor: pointer;
            margin-top: 6px;
        }

        .menuContent {
            background-color: #fff;
            margin: 0 auto;
            height: auto;
            width: 148px;
            text-align: left;
            display: none;
        }

       .menuContent li {
            background: url(../../Images/arr.gif) no-repeat 20px 6px;
            list-style-type: none;
            padding: 0px 0px 0px 38px;
            font-size: 12.7px;
            height: 20px;
            line-height: 20px;
        }

        ul {
            margin: 0;
            padding: 0;
        }
       .menuContent li a {
           cursor: pointer;
        }
    </style>

    <script type="text/javascript">
        $(document).ready(function () {
            getnew(5);
        })
        $(document).ready(

        function () {
            $(".menuTitle").click(function () {
                $(this).next("div").slideToggle("slow")
                .siblings(".menuContent:visible").slideUp("slow");
                $(this).toggleClass("activeTitle");
                $(this).siblings(".activeTitle").removeClass("activeTitle");

            }
            );

        });

        function getnew(i) {
            $.post("../Home/GetNewsContent", { ID: i },
             function (data) {
                 // var t = JSON.parse(data);
                 //  $("#new_title").html() = t.title;

                 var t = JSON.parse(data);
                 document.getElementById("new_title").innerHTML = t.title;
                 document.getElementById("new_time").innerHTML = "发布时间：" + t.time + " 作者:" + t.username;
                 document.getElementById("zoom").innerHTML = t.content;

             });
        }

        function htmldecode(str) {
            str = str.replace(/&amp;/gi, '&');
            str = str.replace(/&nbsp;/gi, ' ');
            str = str.replace(/&quot;/gi, '"');
            str = str.replace(/&#39;/g, "'");
            str = str.replace(/&lt;/gi, '<');
            str = str.replace(/&gt;/gi, '>');
            str = str.replace(/<br[^>]*>(?:(rn)|r|n)?/gi, 'n');
            return str;
        }


    </script>


</asp:Content>
